package com.fmsz.physicalheadline.adapter.news;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.fmsz.physicalheadline.entity.news.NewsTagEntity;
import com.fmsz.physicalheadline.fragments.news.NewsBaseFragment;

import java.util.List;


/**
 * Created by Administrator on 2016/12/15.
 */

public class NewsPagerAdapter extends FragmentPagerAdapter {
    private List<NewsTagEntity.NewsTagData.ChannelsEntity> list;

    public NewsPagerAdapter(FragmentManager fm, List<NewsTagEntity.NewsTagData.ChannelsEntity> list) {
        super(fm);
        this.list = list;
    }

    @Override
    public Fragment getItem(int position) {
        return NewsBaseFragment.newInstance(list.get(position).getId());
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position).getName();
    }
}
